# 汉诺塔

def Counter(): # 计数器
    t=0
    def count():
        nonlocal t 
        t+=1
        return t
    return count

class Stack(object):
    def __init__(self,name) -> None:
        self.name=name
        self.data=[]
    def pop(self):
        return self.data.pop()
    def push(self,a):
        self.data.append(a)
    def show(self):
        return "["+">".join(map(str,self.data))+"]"


def moveT(n,t1,t2,t3):
    if n>=1:
        moveT(n-1,t1,t3,t2)
        moveD(t1,t3)
        moveT(n-1,t2,t1,t3)

def moveD(t1,t3):
    t3.push(t1.pop())
    show()

def show():
    print("{:02}\t{}\t{}\t{}".format(count(),A.show(),B.show(),C.show()))


N = 3 # 盘子总数

A,B,C = Stack("#1"),Stack('#2'),Stack('#3')
for i in range(N):
    A.push(N-i)
count = Counter()
print("step\t{}\t{}\t{}".format("#1","#2","#3"))
show()
moveT(N,A,B,C)